package com.henu.acmrating.dao;

import com.henu.acmrating.pojo.Problem;
import com.henu.acmrating.pojo.ProblemWithUser;
import com.henu.acmrating.pojo.RankItem;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface ProblemMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Problem record);

    int insertOrUpdate(Problem record);

    int insertOrUpdateSelective(Problem record);

    int insertSelective(Problem record);

    Problem selectByPrimaryKey(Integer id);

    List<Problem> selectByUserIdAndProblemUrl(@Param("userId") Integer userId, @Param("problemUrl") String problemUrl);

    List<Problem> selectByUserIdAndProblemUrls(@Param("userId") Integer userId, @Param("problemUrls") Set<String> problemUrls);




    List<Problem> selectAll();

    List<Problem> selectByOjName(@Param("ojName") String ojName);

    List<Problem> selectByRunIdAndOjName(@Param("runId")String runId,@Param("ojName")String ojName);

    int updateByPrimaryKeySelective(Problem record);

    int updateByPrimaryKey(Problem record);

    int updateBatch(List<Problem> list);


    int batchInsert(@Param("list") List<Problem> list);

    int deleteByUserIdAndOjName(@Param("userId") Integer userId, @Param("ojName") String ojName);


    List<ProblemWithUser> problemWithUser();

    List<ProblemWithUser> problemByUserName(@Param("userName") String userName);


    List<RankItem> showRank(@Param("days") Integer days, @Param("role") Integer role);

    List<RankItem> showRankByUser(@Param("days") Integer days, @Param("userName") String userName);

    RankItem showRankByUserId(@Param("days") Integer days, @Param("userId") Integer userId);



}